MODULE GLOBVAR
  !USE NRUTIL, ONLY : ARRAY1D
  IMPLICIT NONE
  
  INTEGER, PARAMETER :: N_ind=707    ! Number of individuals
  INTEGER, PARAMETER :: N_k=10       ! Number of individuals
  INTEGER, PARAMETER :: N_inds=N_ind*N_k   ! Number of simulated individuals
  INTEGER, PARAMETER :: N_test=349   ! Number of test in China REACH curriculum
  !INTEGER, PARAMETER :: N_var=4+2*N_testl   ! Number of parameters
  !INTEGER, PARAMETER :: N_testl=110  ! Number of Language I task
  INTEGER, PARAMETER :: N_testc=70   ! Number of cognitive II task
  INTEGER, PARAMETER :: N_testf=30   ! Number of Fine Motor II task
  INTEGER, PARAMETER :: N_testg=22   ! Number of Gross Motor task
  !INTEGER, PARAMETER :: N_levell=11  ! Number of Language I level
  INTEGER, PARAMETER :: N_levelc=13  ! Number of cognitive II level
  INTEGER, PARAMETER :: N_levelf=7   ! Number of Fine Motor II level
  INTEGER, PARAMETER :: N_levelg=9   ! Number of Gross Motor level
  INTEGER, PARAMETER :: N_x_l0=6     ! Number of initial latent skill 
  INTEGER, PARAMETER :: N_x_eta=6    ! Number of learning parameter 
  INTEGER, PARAMETER :: N_l=2*n_levelc        ! Number of cross level 
  INTEGER, PARAMETER :: N_mom=3*N_testc+N_levelc+177+82+142+5*(N_levelc-1)+5*n_levelc   ! number of moments
  INTEGER, PARAMETER :: N_var=n_x_l0+2*N_levelc+n_x_eta+n_levelc-6+n_levelc+2 ! number of parameters
  INTEGER, PARAMETER :: N_boot=200   
  INTEGER, PARAMETER :: N_mom2=855-7
  
  
  !INTEGER, PARAMETER :: N_int=1000     ! Number of estimation
  
  !INTEGER, PARAMETER :: N_test=5
  !INTEGER, PARAMETER :: N_mom=N_testl*(3*N_test-3)+2*(N_testl-1)*N_test+N_testl*(2*N_test-3)
  !INTEGER :: N_type !N_test, N_test_o,n_order,
  !INTEGER,ALLOCATABLE:: N_cut(:)

  !Task 
  INTEGER :: c_test(N_ind, N_testc),f_test(N_ind, N_testf),g_test(N_ind,N_testg),m_c(N_ind,N_testc),m_f(N_ind,N_testf),m_g(N_ind,N_testg)
  INTEGER :: levelc(N_testc),levelf(N_testf),levelg(N_testg),indc(N_ind,N_testc),indf(N_ind,N_testf),indg(N_ind,N_testg),&
  repc(N_ind,N_testc),repf(N_ind,N_testf),repg(N_ind,N_testg),repeatc(N_testc),repeatf(N_testf),repeatg(N_testg),&
  monthc(N_testc), timec(N_testc),countnum(N_mom),mmboot(n_boot,n_ind),mmb(n_ind),id(n_ind)   
  INTEGER :: duc(n_ind,n_levelc)  
  REAL(8) :: ave(n_ind,n_levelc)  
  REAL(8) :: x_testc(N_ind,N_testc,6),x_testf(N_ind,N_testf,6),x_testg(N_ind,N_testg,6),L0(N_ind,6),firstl(N_ind,2),firstc(N_ind,2),&
  firstf(N_ind,2),firstg(N_ind,2),intermean(N_ind)
  REAL(8) :: moment(N_mom),momentboot(n_boot,n_mom),thetaboot(n_boot,n_var), thetafix(n_x_l0+3*N_levelc+n_x_eta-6)


  ! Variables for MPI
  INTEGER :: myid,numprocs
  
    ! Variance adjustment
  !REAL(8),ALLOCATABLE  :: sigma(:,:)
  
  
  

  
      
  

  
 
  
END MODULE GLOBVAR
